<template>
	<div :id="dyid" style="width: 350px; height: 570px;float: right;"></div>
</template>

<script>
	import * as echarts from 'echarts'
	export default {
		props: {
			dyid: String,
			title: String,
			value: Array
		},
		data: function() {
			return {
				option: "",
				charts: ""
			}
		},
		mounted: function() {
			this.option = {
				title: {
					text: this.title
				},
				tooltip: {
					trigger: 'item'
				},
				legend: {
					left: 'center'
				},
				series: [{
					name: '仓库使用',
					type: 'pie',
					radius: ['20%', '40%'],
					avoidLabelOverlap: false,
					itemStyle: {
						borderRadius: 10,
						borderColor: '#fff',
						borderWidth: 2
					},
					label: {
						show: false,
						position: 'center'
					},
					emphasis: {
						label: {
							show: true,
							fontSize: '20',
							fontWeight: 'bold'
						}
					},
					labelLine: {
						show: false
					},
					data: this.value
				}]
			}
			this.charts = echarts.init(document.getElementById(this.dyid))
			this.charts.setOption(this.option)
		},
		watch:{
			value:{
				handler(nd){
					this.option.series[0].data=nd
					this.charts.setOption(this.option)
				},
				deep:true
			}
		}
	}
</script>

<style>
</style>
